import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:xreader/logs/log.dart';
import 'package:xreader/model/t_book_cont_entity.dart';
import 'package:xreader/model/t_book_entity.dart';

class BookReaderPage extends StatefulWidget {
  const BookReaderPage({Key? key}) : super(key: key);

  @override
  State<BookReaderPage> createState() => _BookReaderPageState();
}

class _BookReaderPageState extends State<BookReaderPage> {
  late final TBookContEntity chapterInfo;
  @override
  void initState() {
    var args = Get.arguments;
    chapterInfo = args  is TBookContEntity ? args : TBookContEntity();
    Log.i("书籍参数==> ${chapterInfo}");
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
     appBar: AppBar(title: Text('${chapterInfo.btitle}'),),
      drawer: Drawer(
        child: ListView(
          children: [
            ListTile(
              title: Text('ListTile1'),
              subtitle: Text('ListSubtitle1',maxLines: 2,overflow: TextOverflow.ellipsis,),
              leading: CircleAvatar(child: Text("1")),
              onTap: (){Navigator.pop(context);},
            ),
            Divider(),//分割线
            ListTile(
              title: Text('ListTile2'),
              subtitle: Text('ListSubtitle2',maxLines: 2,overflow: TextOverflow.ellipsis,),
              leading: CircleAvatar(child: Text("2")),
              onTap: (){Navigator.pop(context);},
            ),
            Divider(),//分割线
          ],
        ),
      ),
      body: Center(
        child:Container(
          child: Text("book reader page ${chapterInfo.btitle ?? ''} "),
        ),
      )
    );
  }
}
